﻿using DoNetDrive.Core.Command;
using DoNetDrive.Protocol.Door.Door8800;
using DoNetDrive.Protocol.OnlineAccess;
using System;
using System.Collections.Generic;
using System.Text;

namespace DoNetDrive.Protocol.Fingerprint.SystemParameter.MasterSlaveMode
{
    /// <summary>
    /// 主机/从机模式读取
    /// </summary>
    public class ReadMasterSlaveMode : Door8800Command_ReadParameter
    {
        /// <summary>
        /// 主机/从机模式读取
        /// </summary>
        /// <param name="cd"></param>
        public ReadMasterSlaveMode(INCommandDetail cd) : base(cd)
        {

        }
        /// <summary>
        /// 命令响应
        /// </summary>
        /// <param name="oPck"></param>
        /// <exception cref="NotImplementedException"></exception>
        protected override void CommandNext1(OnlineAccessPacket oPck)
        {
            if (CheckResponse(oPck, 0x01))
            {
                var buf = oPck.CmdData;
                _Result = new ReadMasterSlaveMode_Result(buf.ReadByte());
                CommandCompleted();
            }
        }
        /// <summary>
        /// 创建命令包
        /// </summary>
        protected override void CreatePacket0()
        {
            Packet(0x01, 0x1F, 0x01);
        }
    }
}
